package com.jy.appmarket.network.resultdata;

import com.jy.app.market.idata.Doc;
import com.jy.app.market.idata.card.CardUpgrade;
import com.jy.app.market.idata.data.Upgrade;

public class UpgradeResultData extends BaseResultData {

	private CardUpgrade mCardUpgrade = new CardUpgrade();

	public CardUpgrade getCardUpgrade() {
		return mCardUpgrade;
	}

	public void setCardUpgrade(CardUpgrade mCardUpgrade) {
		this.mCardUpgrade = mCardUpgrade;
	}

	@Override
	public boolean parseResult(String result) {
		Doc doc = Doc.fromJson(result);
		if (!doc.isOk()) {
			return false;
		}
		setDataType(doc.getDataType());
		setStatus(doc.getStatus());
		setMessage(doc.getMessage());
		Upgrade upgrade = null;

		if (doc.isType(Upgrade.class)) {
			upgrade = doc.getData();
		}
		mCardUpgrade.setUpgrade(upgrade);
		return true;
	}
}
